﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 实现多态：
/// 抽象类和接口是实现多态的主要方式。通过抽象类，您可以定义一组相关类的通用接口，然后让子类提供具体的实现。
/// </summary>
/// 
public abstract class Enemy : MonoBehaviour
{
    public abstract void Attack();
}

public class Zombie : Enemy
{
    public GameObject game;
    public override void Attack()
    {
        Debug.Log("Zombie is attacking!");
    }
}

public class Skeleton : Enemy
{
    public override void Attack()
    {
        Debug.Log("Skeleton is attacking!");
    }
}